package com.example.component.d_content_provider

import android.os.Bundle
import android.widget.Button
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.example.component.R
import com.example.component.d_content_provider.base.DBActivity
import com.example.component.d_content_provider.custom.DCActivity
import com.example.component.util.launchActivity

class DActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_d)
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }
        initButtons()

        launchActivity<DCActivity>()
    }

    private fun initButtons() {
        findViewById<Button>(R.id.baseUsage).setOnClickListener {
            launchActivity<DBActivity>()
        }
        findViewById<Button>(R.id.custom).setOnClickListener {
            launchActivity<DCActivity>()
        }
    }
}